package com.renwen.sms.controller;


import com.renwen.sms.dto.PageResult;
import com.renwen.sms.dto.PingJiaDto;

import com.renwen.sms.exception.MyRuntimeException;

import com.renwen.sms.service.PingJiaService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 课程评价信息控制层
 */
@RestController
@CrossOrigin
@RequestMapping("pingJia/")
public class PingJiaController {
    @Resource
    PingJiaService pingJiaService;

    /**
     * 查询所有评价信息
     * @param page 页
     * @param size 尺寸
     * @param formMap 表格信息
     * @return pingJiaDto集合
     */
    @PostMapping("list")
    public PageResult<PingJiaDto> list(Integer page, Integer size, @RequestBody Map<String, Object> formMap) {
        try {
            return pingJiaService.list(page, size, formMap);
        } catch (Exception e) {
            throw new MyRuntimeException(e.getMessage());
        }
    }
}
